﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="CONSULTACLIENTES.aspx.vb" Inherits="IMSS.SA.Formulario_web11" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            text-align: center;
        }
        .style2
        {
            text-align: center;
        }
        .style3
        {
            text-align: center;
            width: 484px;
            height: 27px;
        }
        .style4
        {
            height: 27px;
        }
        .style8
        {
            text-align: center;
            width: 484px;
        }
        .style9
        {
            text-align: center;
            width: 484px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table style="width:100%; color: #FFFFFF; background-color: #006699; background-image: url('../Styles/r3.PNG'); background-repeat: no-repeat;">
        <tr>
            <td class="style8">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                CONSULTA DE CLIENTES PARA ACTUALIZAR O ELIMINAR</td>
        </tr>
        <tr>
            <td class="style8">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style9">
                DIGITE EL NUMERO DE CEDULA DEL CLIENTE</td>
            <td style="text-align: center">
                <asp:TextBox ID="TextCONSULTA" runat="server" style="text-align: center" 
                    Width="203px" MaxLength="15"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style1" colspan="2">
                <asp:Button ID="BotonCONSULTA" runat="server" Text="CONSULTAR" Width="191px" />
            </td>
        </tr>
        <tr>
            <td class="style3">
            </td>
            <td class="style4">
            </td>
        </tr>
        <tr>
            <td class="style2" colspan="2">
                <asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource1" 
                    DataKeyNames="Num_Cedula">
                    <AlternatingItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="EditButton" runat="server" CommandName="Edit" 
                                    Text="Editar" />
                            </td>
                            <td>
                                <asp:Label ID="Num_CedulaLabel" runat="server" 
                                    Text='<%# Eval("Num_Cedula") %>' />
                            </td>
                            <td>
                                <asp:Label ID="NombreLabel" runat="server" Text='<%# Eval("Nombre") %>' />
                            </td>
                            <td>
                                <asp:Label ID="DireccionLabel" runat="server" Text='<%# Eval("Direccion") %>' />
                            </td>
                            <td>
                                <asp:Label ID="TelefonoLabel" runat="server" Text='<%# Eval("Telefono") %>' />
                            </td>
                            <td>
                                <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ciudadLabel" runat="server" Text='<%# Eval("ciudad") %>' />
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    <EditItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                                    Text="Actualizar" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                    Text="Cancelar" />
                            </td>
                            <td>
                                <asp:Label ID="Num_CedulaLabel1" runat="server" 
                                    Text='<%# Eval("Num_Cedula") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="NombreTextBox" runat="server" 
                                    Text='<%# Bind("Nombre") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="DireccionTextBox" runat="server" 
                                    Text='<%# Bind("Direccion") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="TelefonoTextBox" runat="server" 
                                    Text='<%# Bind("Telefono") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ciudadTextBox" runat="server" Text='<%# Bind("ciudad") %>' />
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <EmptyDataTemplate>
                        <table runat="server" 
                            style="">
                            <tr>
                                <td>
                                    No se han devuelto datos.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <InsertItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                                    Text="Insertar" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                    Text="Borrar" />
                            </td>
                            <td>
                                <asp:TextBox ID="Num_CedulaTextBox" runat="server" 
                                    Text='<%# Bind("Num_Cedula") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="NombreTextBox" runat="server" 
                                    Text='<%# Bind("Nombre") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="DireccionTextBox" runat="server" 
                                    Text='<%# Bind("Direccion") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="TelefonoTextBox" runat="server" 
                                    Text='<%# Bind("Telefono") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ciudadTextBox" runat="server" Text='<%# Bind("ciudad") %>' />
                            </td>
                        </tr>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="EditButton" runat="server" CommandName="Edit" 
                                    Text="Editar" />
                            </td>
                            <td>
                                <asp:Label ID="Num_CedulaLabel" runat="server" 
                                    Text='<%# Eval("Num_Cedula") %>' />
                            </td>
                            <td>
                                <asp:Label ID="NombreLabel" runat="server" Text='<%# Eval("Nombre") %>' />
                            </td>
                            <td>
                                <asp:Label ID="DireccionLabel" runat="server" Text='<%# Eval("Direccion") %>' />
                            </td>
                            <td>
                                <asp:Label ID="TelefonoLabel" runat="server" Text='<%# Eval("Telefono") %>' />
                            </td>
                            <td>
                                <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ciudadLabel" runat="server" Text='<%# Eval("ciudad") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table ID="itemPlaceholderContainer" runat="server" border="0" 
                                        style="">
                                        <tr runat="server" style="">
                                            <th runat="server">
                                                </th>
                                            <th runat="server">
                                                Num_Cedula</th>
                                            <th runat="server">
                                                Nombre</th>
                                            <th runat="server">
                                                Direccion</th>
                                            <th runat="server">
                                                Telefono</th>
                                            <th runat="server">
                                                Email</th>
                                            <th runat="server">
                                                ciudad</th>
                                        </tr>
                                        <tr ID="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <td runat="server" 
                                    
                                    
                                    style="">
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <SelectedItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="EditButton" runat="server" CommandName="Edit" 
                                    Text="Editar" />
                            </td>
                            <td>
                                <asp:Label ID="Num_CedulaLabel" runat="server" 
                                    Text='<%# Eval("Num_Cedula") %>' />
                            </td>
                            <td>
                                <asp:Label ID="NombreLabel" runat="server" Text='<%# Eval("Nombre") %>' />
                            </td>
                            <td>
                                <asp:Label ID="DireccionLabel" runat="server" Text='<%# Eval("Direccion") %>' />
                            </td>
                            <td>
                                <asp:Label ID="TelefonoLabel" runat="server" Text='<%# Eval("Telefono") %>' />
                            </td>
                            <td>
                                <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ciudadLabel" runat="server" Text='<%# Eval("ciudad") %>' />
                            </td>
                        </tr>
                    </SelectedItemTemplate>
                </asp:ListView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:IMSS.SAConnectionString3 %>" 
                    
                    SelectCommand="SELECT * FROM [CLIENTE] WHERE ([Num_Cedula] = @Num_Cedula)" 
                    DeleteCommand="DELETE FROM [CLIENTE] WHERE [Num_Cedula] = @original_Num_Cedula AND (([Nombre] = @original_Nombre) OR ([Nombre] IS NULL AND @original_Nombre IS NULL)) AND (([Direccion] = @original_Direccion) OR ([Direccion] IS NULL AND @original_Direccion IS NULL)) AND (([Telefono] = @original_Telefono) OR ([Telefono] IS NULL AND @original_Telefono IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([ciudad] = @original_ciudad) OR ([ciudad] IS NULL AND @original_ciudad IS NULL))" 
                    
                    UpdateCommand="UPDATE [CLIENTE] SET [Nombre] = @Nombre, [Direccion] = @Direccion, [Telefono] = @Telefono, [Email] = @Email, [ciudad] = @ciudad WHERE [Num_Cedula] = @original_Num_Cedula AND (([Nombre] = @original_Nombre) OR ([Nombre] IS NULL AND @original_Nombre IS NULL)) AND (([Direccion] = @original_Direccion) OR ([Direccion] IS NULL AND @original_Direccion IS NULL)) AND (([Telefono] = @original_Telefono) OR ([Telefono] IS NULL AND @original_Telefono IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([ciudad] = @original_ciudad) OR ([ciudad] IS NULL AND @original_ciudad IS NULL))" 
                    ConflictDetection="CompareAllValues" 
                    OldValuesParameterFormatString="original_{0}" 
                    InsertCommand="INSERT INTO [CLIENTE] ([Num_Cedula], [Nombre], [Direccion], [Telefono], [Email], [ciudad]) VALUES (@Num_Cedula, @Nombre, @Direccion, @Telefono, @Email, @ciudad)">
                    <DeleteParameters>
                        <asp:Parameter Name="original_Num_Cedula" Type="String" />
                        <asp:Parameter Name="original_Nombre" Type="String" />
                        <asp:Parameter Name="original_Direccion" Type="String" />
                        <asp:Parameter Name="original_Telefono" Type="String" />
                        <asp:Parameter Name="original_Email" Type="String" />
                        <asp:Parameter Name="original_ciudad" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Num_Cedula" Type="String" />
                        <asp:Parameter Name="Nombre" Type="String" />
                        <asp:Parameter Name="Direccion" Type="String" />
                        <asp:Parameter Name="Telefono" Type="String" />
                        <asp:Parameter Name="Email" Type="String" />
                        <asp:Parameter Name="ciudad" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="TextCONSULTA" Name="Num_Cedula" 
                            PropertyName="Text" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Nombre" Type="String" />
                        <asp:Parameter Name="Direccion" Type="String" />
                        <asp:Parameter Name="Telefono" Type="String" />
                        <asp:Parameter Name="Email" Type="String" />
                        <asp:Parameter Name="ciudad" Type="String" />
                        <asp:Parameter Name="original_Num_Cedula" Type="String" />
                        <asp:Parameter Name="original_Nombre" Type="String" />
                        <asp:Parameter Name="original_Direccion" Type="String" />
                        <asp:Parameter Name="original_Telefono" Type="String" />
                        <asp:Parameter Name="original_Email" Type="String" />
                        <asp:Parameter Name="original_ciudad" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
</asp:Content>
